﻿using ETA.DtoMappings;
using ETA.Entity;
using ETA.IService;
using Ninject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ETA.ClientService
{

    public class UserBll
    {
        private static IUserService _IUserService { set; get; }

        static UserBll()
        {
            IKernel kernel = KernelHelper.GetKernel();
            _IUserService = kernel.Get<IUserService>();

        }
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns></returns>
        public static User GetCompltetUserInfo(string userId)
        {
            User user = null;
            var req = new QueryUserRequest
            {
                User = new User
                {
                    UserId = userId
                }
            };
            var queryUserResponse = _IUserService.QueryUser(req);
            if (queryUserResponse.Result.IsSuccess)
            {
                user = queryUserResponse.Users.FirstOrDefault();
            }
            return user;
        }
    }
}
